package com.immunology.database.transformers;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.apache.log4j.Logger;

import com.immunology.core.BaseTransformer;
import com.immunology.database.DbColumns;
import com.immunology.model.Complaint;
import com.immunology.model.User;
import com.immunology.model.enums.Role;

public class ComplaintTransformer extends BaseTransformer<Complaint> {
	private static final Logger LOG = Logger
			.getLogger(ComplaintTransformer.class);

	@Override
	public Complaint transformTo(ResultSet resultSet) {
		Complaint complaint = new Complaint();
		try {
			complaint.setId(resultSet.getInt(DbColumns.FIRST_COLUMN));
			complaint.setName(resultSet.getString(DbColumns.SECOND_COLUMN));
			complaint.setTypeId(resultSet.getInt(DbColumns.THIRD_COLUMN));
		} catch (SQLException e) {
			LOG.error("Can't create ComplaintTransformer object:", e);
		}
		return complaint;
	}

}
